script "phazercs.ash";
import <phazercs_aux.ash>

// hosted at 
// https://notabug.org/phazer/phazercs


// references:
// https://github.com/MrFizzyBubbs/fizz-sccs
// https://github.com/Malurth/Auto-2-day-HCCS/blob/master/scripts/AutoHCCS.ash
// https://github.com/C2Talon/c2t_hccs/tree/master/kolmafia


int START_TIME = now_to_int();

int HPTEST = 1;
int MUSTEST = 2;
int MYSTTEST = 3;
int MOXTEST = 4;
int FAMTEST = 5;
int WPNTEST = 6;
int SPELLTEST = 7;
int COMTEST = 8;
int ITEMTEST = 9;
int HOTTEST = 10;
int COILTEST = 11;
int COMPLETERUN = 30;


// todo: add support for Rufus
/*
Unsupported choice adventure #1497
choice 1: I'll fight the entity
choice 2: I'll find the artifact
choice 3: I'll collect the goods
choice 6: Hang up
*/

// TESTS //

// hp, mys, mox, mus - 1 turn
// familiar weight - 49 adv
// NC - 3 adv
// spell dmg - 45 adv
// wpn dmg - 35 adv 
// hot res - 3 adv (can be 2 lower if we reconfigure trainset to have hot res first before saber fight)
// item - 22 adv


/* 
  coil > donate blood > playground > conspirators > feed the children > 
  > collies > statue > gazelle > steam > margaritas
*/

// ascend Sauceror, Opossum. astral pilsner, astral pet sweater

// *************//
// CONFIG STUFF // 
// *************//

// buy from NPCs
set_property("autoSatisfyWithNPCs", "true");
// buy from coinmasters/hermit
set_property("autoSatisfyWithCoinmasters", "true");	
// no mana burn, every mp is sacred
set_property("manaBurningThreshold", "-0.05");
// turn off Lil" Doctor quests
set_property("choiceAdventure1340", "3");
// saber stuff - we can choose any one, we just need it for fire extinguisher later
set_property("choiceAdventure1387", "1"); 

// *************//
// TURN 0 STUFF //
// *************//

// enable reverser for backup camera (prevent backwards text)
if (!get_property("backupCameraReverserEnabled").to_boolean()) {
  cli_execute("backupcamera reverser on");
}

// familiar; this is very important
cli_execute("familiar cookbookbat");

// visit toot
visit_url("tutorial.php?action=toot");

// use letter
use(item_amount($item[Letter From King Ralph XI]), $item[Letter From King Ralph XI]);
cli_execute("refresh quests"); // some workaround for something

// sell everything
use(item_amount($item[Pork Elf Goodies Sack]), $item[Pork Elf Goodies Sack]);
autosell(min(5, item_amount($item[hamethyst])), $item[hamethyst]);
autosell(min(5, item_amount($item[baconstone])), $item[baconstone]);
autosell(min(5, item_amount($item[porquoise])), $item[porquoise]);

// make codpiece, and get some free meat
cli_execute("acquire 1 codpiece");
cli_execute("use 1 codpiece");
cli_execute("make 1 oil cap");
cli_execute("sell 1 oil cap");


cli_execute("use astral six-pack");


// buy toy accordion
cli_execute("buy toy accordion");

// get basic stuff
if (!have($item[saucepan])) {
  acquire($item[saucepan]);
}

if (!have($item[turtle totem])) {
  acquire($item[turtle totem]);
}

// if (get_property("backupCameraMode") != "ml") {
//   cli_execute("backupcamera ml");
// } 

// saber familiar
if (get_property("_saberMod") == "0") {
  cli_execute("saber familiar");
} 

// send autumnaton for autumn leaf
cli_execute("autumnaton send Sleazy Back Alley");

// initialize council
visit_url("council.php"); 

// change ML
if(canadia_available()) {
  change_mcd(11);
} else {
  change_mcd(10);
}

// we don't need ice crown - we lose 3 adventures, but we gain ~240k post-run
// get ice crown
// cli_execute("use 1 cold medicine cabinet");
// visit_url("campground.php?action=workshed");
// run_choice(1); // get ice crown 

// switch to trainset
cli_execute("use 1 model train set");
// configure trainset, we won't change this for the rest of the run. 

modelTrainSet();

// pull borrowed time, buying if needed
pull($item[borrowed time], 20000);

// use borrowed time
use(item_amount($item[borrowed time]), $item[borrowed time]);

// *************//
//   COIL WIRE  //
// *************//
// coil wire straight away
// maximize mp first because spending 60 adventures can give us more mp from inner sauce
maximize("mp", false);

// coil wire 
print("[!] Coiling wire...", "teal");
if (my_adventures() >= 60) {
    doTest(COILTEST);
  } else {
    abort("Failed to generate enough adventures to coil wire.");
}

// ************************************** //
// AFTER COIL WIRE, BEFORE POWER LEVLLING //
// ************************************** //

use_skill(1, $skill[Advanced Saucecrafting]); // get reagents

// buff mys%
cli_execute("shower mys");
ensureMp(10);
use_skill(1, $skill[Inscrutable Gaze]);

// pull mys%
// technically, we can do without non-euclidean angle. but not sure what to pull instead
pull($item[Non-Euclidean angle], 30000);
// not mission-critical to have this, so no point aborting the script over it
if (have($item[Non-Euclidean angle])) {
  chew(1, $item[Non-Euclidean angle]);
}

// use ten-percent bonus
use(1, $item[a ten-percent bonus]);

// get mys buff from fortune
cli_execute("fortune buff mys");

// now we have 0 adv, we must drink/eat something here
// let's eat the legendary food here
pull($item[Pizza of Legend]);
eat(1, $item[Pizza of Legend]);

// now we have 0 adv, we must drink/eat something here
// let's eat the legendary food here
pull($item[Calzone of Legend]);
eat(1, $item[Calzone of Legend]);

// familiar; this is very important
cli_execute("familiar cookbookbat");

// GET FRUITS FOR REAGENTS //
// visit the meatsmith to unlock skeleton store
if (get_property('questM23Meatsmith') == 'unstarted') {
  // Have to start meatsmith quest.
  visit_url('shop.php?whichshop=meatsmith&action=talk');
  run_choice(1);
}

cli_execute("buy 1 yellow rocket");
// yellow ray the tropical skeleton
/*
if monstername *tropical skeleton
    item yellow rocket
endif
if hasskill Bowl a curveball
    skill bowl a curveball
endif
skill snokebomb

*/
cli_execute("ccs yr");

// _count turns
int _count;

// intro adventure (this is not a combat, it's just an intro)
adv1($location[the skeleton store],-1,'');

// 1st adv
adv1($location[the skeleton store],-1,'');
ensureMp(50);
// need to setup the ccs
// check for tropical skeleton within the ccs itself
// 1st ccs: if not tropical, bowl a curveball, else, yellow rocket
// 2nd ccs: if not tropical, snokebomb, else, 
// check for fruits, if no fruits go to 

// check for cherry

// 2nd adv
if (!have($item[cherry])) {
  ensureMp(50);
  adv1($location[the skeleton store],-1,'');
  _count = _count + 1;
}

// 3rd adv
if (!have($item[cherry])) {
  ensureMp(50);
  adv1($location[the skeleton store],-1,'');
  _count = _count + 1;
}

// we should have the cherry by now! if not, something went wrong
if (!have($item[cherry])) {
  abort("You still didn't find the tropical skeleton, something is wrong!");
}




// ****************//
// POWER LEVELLING // 
// ****************//

ensureMp(50);


// set mood (this should have all the mys and mys statgain buffs)
cli_execute("mood cs");
cli_execute("cast 1 feel peaceful");

// maximize mys and ML
maximize("myst, 5 ML, 3 exp, 30 mysticality experience percent, equip parka", false);

// get +ML% for umbrella
cli_execute("umbrella ml");

// we want to level until we hit 195 mysticality.
int mys =  my_basestat($stat[mysticality]);

// force 20% mys non combat // 
// set up the ccs first!
cli_execute("ccs cs_spike");

// parka spikes
/* 
[ default ]
skill curse of weaksauce
if hasskill feel pride
    skill feel pride
endif
if hasskill Bowl Sideways
    skill bowl sideways
endif
skill launch spikolodon spikes
skill saucestorm
*/
cli_execute("parka spikes");

// skip NEP quest
set_property("choiceAdventure1322", "2");
// get 20% mys non combat
set_property("choiceAdventure1324", "1");
set_property("choiceAdventure1325", "2");

ensureSafeAdv();
adv1($location[The Neverending Party], -1, ""); // clear intro quest (decline it)
adv1($location[The Neverending Party], -1, ""); // force the 20% mys noncombat via spikes
// we got beaten up here the first time, not sure what to do about that ....
adv1($location[The Neverending Party], -1, ""); // get the 20% mys noncombat


ensureSafeAdv();
adv1($location[The Neverending Party], -1, ""); // force the 20% mys noncombat via spikes
adv1($location[The Neverending Party], -1, ""); // get the 20% mys noncombat

ensureSafeAdv();
adv1($location[The Neverending Party], -1, ""); // force the 20% mys noncombat via spikes
adv1($location[The Neverending Party], -1, ""); // get the 20% mys noncombat

// we will spend at least 55 turns levelling, so obtain at least 55 turns of the 20% mys buff



cli_execute("ccs cs_powerlevel"); // config this first
/* 
[ default ]
if !mpbelow 8
    skill curse of weaksauce
endif
if hasskill feel pride
    skill feel pride
endif
if hasskill Bowl Sideways
    skill bowl sideways
endif
if !mpbelow 8
    skill stuffed mortar shell
endif
if hppercentbelow 60
    while !mpbelow 24
        skill saucegeyser
    endwhile
    attack with weapon
endif
while !mpbelow 6
    skill saucestorm
endwhile
attack with weapon
*/

// skip NEP quest
set_property("choiceAdventure1322", "2");
// fight during non-combat
set_property("choiceAdventure1324", "5");

// ******************** //
// MAIN LEVELLING PHASE //
// ******************** //



// maximize mys and ML
maximize("myst, 5 ML, 3 exp, 30 mysticality experience percent", false);


// fight witchess bishop for +item booze
// cli_execute("equip backup camera");
ensureMp(50);
ensureHp(1.0);
ensureMp(70);

cli_execute("ccs cs_powerlevel"); // config this first
cli_execute("reminisce witchess bishop");

// we don't really need the backups
// cli_execute("ccs cs_backup"); // config this first

// // fight 2 more witchess bishops
// ensureHp(1.0);
// ensureMp(50);
// adv1($location[noob cave],-1,'');

// ensureHp(1.0);
// ensureMp(50);
// adv1($location[noob cave],-1,'');



// get +ML% for umbrella
cli_execute("umbrella ml");
cli_execute("familiar cookbookbat");

boolean perfectDrink = false; // checks if we drank a perfect drink today
boolean madeReagents = false; // checks if we made reagents

cli_execute("ccs cs_powerlevel"); // config this first

// maximize mys and ML
maximize("myst, 5 ML, 3 exp, 30 mysticality experience percent", false);

while (mys < 190 && my_adventures() > 0) {
  print("[ " + to_string(_count) + " ] Adventuring in NEP... ", "teal");
  print("[ " + to_string(_count) + " ] Current mys: " + to_string(mys) + ". Target mys: 195", "teal");
  
  // In between adventures //

  if (!madeReagents) {
    madeReagents = makeReagents(); // try to make reagents
  }

  if (my_level() > 5 && my_mp() > 40 && !perfectDrink) {
    boolean successPerfectDrink = drinkPerfectDrink(); 
    if (successPerfectDrink) {
      perfectDrink = true;
    }
  }

  

  if (my_level() >= 11 && have($item[astral pilsner])) {
    ensureMp(100);
    cli_execute("shrug magical mojo");
    use_skill(2, $skill[Ode to Booze]);
    cli_execute("drink 6 astral pilsner");
  }

  // get this when we have enough meat
  if (!have($item[Catherine Wheel]) && my_meat()>1000) {
    cli_execute("buy 1 catherine wheel");
    // maximize mys and ML
    maximize("myst, 5 ML, 3 exp, 30 mysticality experience percent", false);

    // get +ML% for umbrella
    cli_execute("umbrella ml");

    cli_execute("familiar cookbookbat");
  }

  if (!get_property("hasRange").to_boolean() && my_meat()>1000) {
    acquire($item[Dramatic&trade; range]);
    use(1, $item[Dramatic&trade; range]);
  }
  if (item_amount($item[autumn-aton]) > 0) {
    cli_execute("autumnaton send The Haunted Pantry");
  }

  // if (!get_property("hasCocktailKit").to_boolean() && my_meat()>1000) {
  //   acquire($item[Queue Du Coq cocktailcrafting kit]);
  //   use(1, $item[Queue Du Coq cocktailcrafting kit]);
  // }

  // ensure we are safe before fighting
  ensureSafeAdv();

  adv1($location[The Neverending Party], -1, "");

  _count = _count + 1;
  mys =  my_basestat($stat[mysticality]);


  // // leave at least 1 for item test
  // if (my_adventures() <= 1 && have($item[Sacramento wine], 2)) {
  //   ensureMp(50);
  //   use_skill(1, $skill[Ode to Booze]);
  //   drink(1, $item[Sacramento wine]);
  // }
}

//************** //
// USE FREEKILLS // 
//************** //
boolean shadowBuff;
// attempt rufus shadow quest
shadowBuff = rufusQuest(false); // false to avoid fighting boss
_count = _count + 11;

// todo: change order so we can use the buffs if the boss is defeated

// use our free kills here
cli_execute("ccs cs_freekill"); // include shattering punch, reflex hammer
/*
[ default ]
if hasskill chest x-ray
    skill chest x-ray
endif
if hasskill shattering punch
    skill shattering punch
endif
skill curse of weaksauce
if hasskill feel pride
    skill feel pride
endif
if hasskill Bowl Sideways
    skill bowl sideways
endif
skill stuffed mortar shell
if hppercentbelow 60
    skill saucegeyser
endif
skill saucestorm
*/

// include lil doc bag for freekills
maximize("myst, 5 ML, 3 exp, 30 mysticality experience percent, equip lil doc bag", false);

// we want to spend at least 55 turns to get 5x drops from cookbookbat
// i don't think we need a ccs just for doc bag, we can just use if hasskill <...>
// TODO: add banish support, if mys is >= 195 but _count < 55...
while ((mys < 195) || (_count < 55)) { 
  print("[ " + to_string(_count) + " ] Adventuring in NEP... ", "teal");
  print("[ " + to_string(_count) + " ] Current mys: " + to_string(mys) + ". Target mys: 195", "teal");

  // maximize mys and ML, remove lil doc bag once freekills used
  if (to_int(get_property("_chestXRayUsed")) >= 3) {
    maximize("myst, 5 ML, 3 exp, 30 mysticality experience percent", false);
  }

  // get +ML% for umbrella
  cli_execute("umbrella ml");

  
  // ensure we are safe before fighting 
  ensureSafeAdv();
  adv1($location[The Neverending Party], -1, "");

  _count = _count + 1;
  mys =  my_basestat($stat[mysticality]);

  // if (my_adventures() <= 1 && have($item[Sacramento wine], 2)) {
  //   ensureMp(50);
  //   use_skill(1, $skill[Ode to Booze]);
  //   drink(1, $item[Sacramento wine]);
  // }
}


//********************** //
// AFTER POWER LEVELLING //
//********************** //

cli_execute("shrug ur-kel");
cli_execute("shrug magical mojo");

// get dough for one of our dishes later
acquire($item[all-purpose flower]);
cli_execute("use all-purpose flower");
cli_execute("use 1 wad of dough");

// get favored by lyle buff
cli_execute("monorail");

ensureMp(50);
use_skill(1, $skill[Ode to Booze]);
cli_execute("drink bee's knees"); // we should have enough meat

// make food
acquire($item[honey bun of Boris]);
acquire($item[ roasted vegetable of Jarlsberg ]);
acquire($item[ Pete\'s Rich Ricotta  ]);
acquire($item[plain calzone]);
acquire($item[baked veggie ricotta casserole]);
pull($item[deep dish of legend]);

eat(1, $item[honey bun of Boris]);
eat(1, $item[ roasted vegetable of Jarlsberg ]);
eat(1, $item[ Pete\'s Rich Ricotta  ]);
eat(1, $item[plain calzone]);
eat(1, $item[baked veggie ricotta casserole]);
eat(1, $item[deep dish of legend]);

// disable powerlevelling mood
cli_execute("mood apathetic");

// fight witchess king
// we can try to save a reminisce for aftercore. we can cap the tests without dented scepter
// loses 2 turns on weapon test
// ensureHp(1.0); 
// ensureHp(1.0);
// ensureHp(1.0);
// ensureHp(1.0);
// ensureHp(1.0);
// ensureHp(1.0); // unless i change ensureHp to a while loop, this is necessary

// ensureMp(450);
// cli_execute("cast 1 feel peaceful");
// cli_execute("ccs cs_tough");
// cli_execute("reminisce witchess king");

// i don't think we need wiley bar to cap moxie. that means we only need 5 drops from cbbat
// acquire($item[ Pete\'s wiley whey bar]);
// eat(1, $item[Pete\'s wiley whey bar]);

// get ungulith stuff
// this is important. if faxbox is down, reminisce 
ensureHp(1.0);
ensureMp(50);
cli_execute("ccs cs_polar");
cli_execute("equip industrial fire ext");

boolean faxFailed = false;
print("Faxing a ungulith!", "teal");
chat_private("Cheesefax", "ungulith");
int timeout;

repeat {
  if ((item_amount($item[Photocopied Monster]) == 1) && (get_property("photocopyMonster") != "ungulith")) {
    cli_execute("fax send");
    print("Faxing a ungulith!", "teal");
    chat_private("Cheesefax", "ungulith");
  }
  waitq(9 + random(3));
  timeout++;
  cli_execute("fax get");
  if (timeout > 10) {
    print("We spent 100 seconds trying to get a fax from cheesefax but failed to acquire one");
    faxFailed = true;
    break;
  } // must check if the photocopied monster matches!
} until ((item_amount($item[Photocopied Monster]) == 1) && (get_property("photocopyMonster") == "ungulith"));

if ((have($item[Photocopied Monster])) && (get_property("photocopyMonster") == "ungulith")) {
  use(1, $item[Photocopied Monster]);
  run_combat();
} else {
  faxFailed = true;
}

// get red skeleton stuff
if (faxFailed) {
  cli_execute("ccs cs_polar");
  cli_execute("reminisce ungulith");
} else {
  cli_execute("ccs cs_envy");
  cli_execute("reminisce red skeleton");
}



//*******//
// TESTS //
//*******//

// mys test 
cli_execute("cast 1 feel excitement");
cli_execute("use 1 ointment of the occult");
cli_execute("maximize myst");

int mysAtTest = my_buffedstat($stat[mysticality]) - my_basestat($stat[mysticality]);

print("[!] Doing mys test...", "teal");
if (my_adventures() > 1) {
    doTest(MYSTTEST);
  } else {
    abort("Failed to generate enough adventures.");
}

// hp test

int hpAtTest = my_maxhp();
cli_execute("maximize hp");

print("[!] Doing hp test...", "teal");
if (my_adventures() > 1) {
    doTest(HPTEST);
  } else {
    abort("Failed to generate enough adventures.");
}


// mox test 
cli_execute("buy 1 hair spray");
cli_execute("use 1 hair spray");
cli_execute("use 1 oil of expertise");
cli_execute("maximize mox");

// if not using oil of expertise (e.g. if using pasta thralls), basestat is mysticality instead
int moxAtTest = my_buffedstat($stat[moxie]) - my_basestat($stat[moxie]);

print("[!] Doing mox test...", "teal");
if (my_adventures() > 1) {
    doTest(MOXTEST);
  } else {
    abort("Failed to generate enough adventures.");
}

// mus test 
cli_execute("buy 1 ben-gal");
cli_execute("use 1 ben-gal");
cli_execute("use 1 philter of phorce");
cli_execute("maximize mus");

// if not using oil of expertise (e.g. if using pasta thralls), basestat is mysticality instead
int musAtTest = my_buffedstat($stat[muscle]) - my_basestat($stat[muscle]);

print("[!] Doing mus test...", "teal");
if (my_adventures() > 1) {
    doTest(MUSTEST);
  } else {
    abort("Failed to generate enough adventures.");
}

// famwt
cli_execute("maximize familiar weight");
// cli_execute("pool 1");
cli_execute("cast 1 leash");
cli_execute("cast 1 empathy");

int famwtAtTest = familiar_weight(my_familiar()) + weight_adjustment();

print("[!] Doing fam wt test...", "teal");
if (my_adventures() > 1) {
    doTest(FAMTEST);
  } else {
    abort("Failed to generate enough adventures.");
}

// nc
ensureMp(300);
cli_execute("buy 1 porkpie-mounted popper");
cli_execute("use shady shades");
cli_execute("use squeaky toy rose");
cli_execute("swim sprints");
cli_execute("cast 1 feel lonely");
cli_execute("cast 1 smooth move");
cli_execute("cast 1 sonata of sneak");
cli_execute("familiar disgeist");
cli_execute("maximize -combat");

int combatRateAtTest = to_int(numeric_modifier("Combat Rate"));

print("[!] Doing nc test...", "teal");
if (my_adventures() > 1) {
    doTest(COMTEST);
  } else {
    abort("Failed to generate enough adventures.");
}

cli_execute("shrug sonata of sneak");

// spell dmg
ensureMp(300);
cli_execute("use corrupted marrow");
cli_execute("cargo pick 177");
cli_execute("use Yeg's Motel hand soap");
cli_execute("cast 1 carol of the hells");
cli_execute("cast 1 jackass");
cli_execute("cast 1 arched eyebrow");
cli_execute("cast 1 spirit of pepper");
cli_execute("cast 1 simmer");
cli_execute("buy 2 obsidian nutcracker");
cli_execute("pool 2");
cli_execute("maximize spell dmg");

int spellDmgAtTest = to_int(numeric_modifier("Spell Damage"));
int spellDmgPercentAtTest = to_int(numeric_modifier("Spell Damage Percent"));

print("[!] Doing spell dmg test...", "teal");
if (my_adventures() > 1) {
    doTest(SPELLTEST);
  } else {
    abort("Failed to generate enough adventures.");
}

// wpn dmg
ensureMp(300);
cli_execute("use corrupted marrow");
cli_execute("use red eye");
cli_execute("cast 1 carol of the bulls");
cli_execute("cast 1 jackass");
cli_execute("cast 1 rage of the rein");
cli_execute("cast 1 scowl of the");
cli_execute("cast 1 ode");
cli_execute("drink 1 sockdollager");
cli_execute("buy 1 goofily-plumed helmet");
visit_url("clan_viplounge.php?action=lookingglass&whichfloor=2");
cli_execute("hatter goofily-plumed helmet");
cli_execute("cast 1 bow-legged swagger");
cli_execute("pool 1");
cli_execute("maximize weapon dmg");

int weaponDmgAtTest = to_int(numeric_modifier("Weapon Damage"));
int weaponDmgPercentAtTest = to_int(numeric_modifier("Weapon Damage Percent"));

print("[!] Doing wpn dmg test...", "teal");
if (my_adventures() > 1) {
    doTest(WPNTEST);
  } else {
    abort("Failed to generate enough adventures.");
}

// hot res
/*
[ default ]
skill fire extinguisher: foam yourself
skill use the force
*/
ensureMp(300);


/*
[ default ]
if hasskil bowl straight up
    skill bowl straight up
endif
skill fire extinguisher: foam yourself
skill use the force
*/
cli_execute("ccs cs_hotres"); // todo: include bowl straight up
cli_execute("maximize equip industrial fire extinguisher, equip saber"); // saber trick for 30 hotres
adv1($location[noob cave],-1,'');
cli_execute("use pocket maze");
cli_execute("cast 1 feel peaceful");
cli_execute("cast 1 elemental saucesphere");
cli_execute("cast 1 astral shell");
// cli_execute("use 1 silver face paint"); // saves 1 adventure
cli_execute("familiar exotic parrot");
cli_execute("maximize hot res");

int hotResAtTest = to_int(numeric_modifier("Hot Resistance"));

print("[!] Doing hotres test...", "teal");
if (my_adventures() > 1) {
    doTest(HOTTEST);
  } else {
    abort("Failed to generate enough adventures.");
}

// item

cli_execute("buy hermit permit");
acquire($item[11-leaf clover]);
cli_execute("use 1 11-leaf clover");
adv1($location[The Limerick Dungeon],-1,'');

ensureMp(400);
cli_execute("use cyclops eyedrops");
cli_execute("cast 1 singer");
cli_execute("cast 1 bind spice");
cli_execute("use bag of grain");
cli_execute("cast 1 phat loot");
cli_execute("pool 3");
cli_execute("cast 1 ode");
cli_execute("drink 1 sacramento wine");

acquire($item[roasted vegetable of Jarlsberg]);
eat(1, $item[roasted vegetable of Jarlsberg]);

if (have($item[autumn leaf])) {
  cli_execute("use 1 autumn leaf");
}
cli_execute("cast 1 feel lost");
cli_execute("cast 1 steely-eyed squint");
cli_execute("maximize +item");

int itemDropAtTest = to_int(numeric_modifier("Item Drop"));

print("[!] Doing item test...", "teal");
if (my_adventures() > 1) {
    doTest(ITEMTEST);
  } else {
    abort("Failed to generate enough adventures.");
}

// complete run
visit_url("council.php");
visit_url("choice.php?whichchoice=1089&option=30"); // donate is choice 30

// time run
float milliseconds = now_to_int().to_float() - START_TIME;
print("Run complete! This run took " +  to_string((milliseconds / 1000) / 60) + " minutes", "green");

// print stats
print("Stats during test: ", "teal");
print("HP: " + to_string(hpAtTest), "teal");
print("Myst: " + to_string(mysAtTest), "teal");
print("Moxie: " + to_string(moxAtTest), "teal");
print("Muscle: " + to_string(musAtTest), "teal");
print("Familiar Weight: " + to_string(famwtAtTest), "teal");
print("Spell Damage (flat and percent): " + to_string(spellDmgAtTest) + " " + to_string(spellDmgPercentAtTest) + "%", "teal");
print("Weapon Damage (flat and percent): " + to_string(weaponDmgAtTest) + " " + to_string(weaponDmgPercentAtTest) + "%", "teal");
print("Hot Resistance: " + to_string(hotResAtTest), "teal");
print("Non-combat Rate: " + to_string(combatRateAtTest), "teal");
print("Item Drop: " + to_string(itemDropAtTest), "teal");

// pull stuff
cli_execute("refresh all");
cli_execute("pull all");
cli_execute("breakfast");